const path = require('path');

function resolve(dir) {
  return path.join(__dirname, dir);
}

module.exports = {
  baseUrl: process.env.NODE_ENV === 'production' ? './' : '/',
  assetsDir: './',
  devServer: {
    proxy: {
      '/api':{
        target: 'http://localhost:3000/mock/11/',
        changeOrigin: true,
        pathRewrite: {
          '^/api': '/'
        }
      },
      '/api2': {
        target: 'https://47.97.214.92:8443',
        changeOrigin: true,
        pathRewrite: {
          '^/api': '/'
        }
      }
    }
  },

  lintOnSave: true,
  // productionSourceMap：{ type:Bollean,default:true } 生产源映射
  productionSourceMap: false,
  chainWebpack: config => {
    config.devServer
      .set('disableHostCheck', true);
    config.resolve.extensions.add('.vue')
      .add('.scss');
    config.resolve.alias.set('@', resolve('src'))
      .set('assets', resolve('src/assets'))
      .set('components', resolve('src/components'))
      .set('views', resolve('src/views'));
  }
};
